package juc.threadcore.MuitThreadsError;

public class MultiThreadsError implements Runnable {
    int index = 0;
    static MultiThreadsError multiThreadsError = new MultiThreadsError();

    public static void main(String[] args) throws InterruptedException {
        Thread thread1 = new Thread(multiThreadsError);
        Thread thread2 = new Thread(multiThreadsError);
        thread1.start();
        thread2.start();
        thread1.join();
        thread2.join();
        System.out.println(multiThreadsError.index);

    }

    @Override
    public void run() {
        for (int i = 0; i < 10000; i++) {
            index++;
        }
    }
}
